#define _CRT_SECURE_NO_WARNINGS
#include"BT.h"
BTNode* BinaryTreeCreate(BTDataType* a, int* pi)
{
	if (a[*pi] == '#')
	{
		*pi++;
		return;
	}
	BTNode* newnode = (BTNode*)malloc(sizeof(BTNode));
	newnode->_data = a[*pi];
	newnode->_left = BinaryTreeCreate(a, pi);
	newnode->_right = BinaryTreeCreate(a, pi);
	return newnode;

}
void LevelOrder(BTNode* root)
{
	Que q;
	QueueInit(&q);

	if (root)
		QueuePush(&q, root);

	while (!QueueEmpty(&q))
	{
		BTNode* front = QueueFront(&q);
		printf("%d ", front->val);
		if (front->left)
			QueuePush(&q, front->left);

		if (front->right)
			QueuePush(&q, front->right);

		QueuePop(&q);
	}
	printf("\n");

	QueueDestroy(&q);
}